﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="AdminUser.aspx.cs" Inherits="AdminUser" %>
<%@ Register Src="UserControls/Nav.ascx" TagName="Nav" TagPrefix="uc"%>
<%@ Register Src="UserControls/Footer.ascx" TagName="Footer" TagPrefix="uc"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta name="Generator" content="EditPlus" />
	<meta name="Author" content="FanFu" />
	<meta name="Keywords" content="" />
	<meta name="Description" content="" />

	<title>用户管理</title>
	<link href="css/base.css" rel="stylesheet" type="text/css" />
    <link href="css/custom-theme/jquery-ui-1.8.14.custom.css" rel="stylesheet" type="text/css" />
	<script src="js/jquery-1.6.1.min.js" type="text/javascript"></script>
	<script src="js/effect.js" type="text/javascript"></script>
    <script src="js/jquery.ui.datepicker-zh-CN.js" type="text/javascript" ></script>
    <script src="js/jquery-ui-1.8.14.custom.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(function () {
            $("#searchStartRegistTime").datepicker({
                maxDate: new Date(9999, 12, 31),
                minDate: new Date(1753, 1, 1),
                autoSize:true,
                changeMonth: true,
                changeYear: true
            });

            $("#searchEndRegistTime").datepicker({
                maxDate: new Date(9999, 12, 31),
                minDate: new Date(1753, 1, 1),
                autoSize: true,
                changeMonth: true,
                changeYear: true
            });
        });
        
        function ValidatorInput() {
            if ($.trim($("#txtUserName").val()) == "") {
                PopupMsg('error', '用户名不能为空！');
                $("#txtUserName").focus();
                return false;
            }
            if ($.trim($("#txtUserPwd").val()) == "") {
                PopupMsg('error', '密码不能为空！');
                $("#txtUserPwd").focus();
                return false;
            }
            if ($.trim($("#txtAffirmUserPwd").val()) == "") {
                PopupMsg('error', '验证密码不能为空！');
                $("#txtAffirmUserPwd").focus();
                return false;
            }
            if ($.trim($("#txtUserAlias").val()) == "") {
                PopupMsg('error', '用户别名不能为空！');
                $("#txtUserAlias").focus();
                return false;
            }
            if ($.trim($("#txtUserPwd").val()) != $.trim($("#txtAffirmUserPwd").val())) {
                PopupMsg('error', '两次输入的密码不一样！');
                $("#txtAffirmUserPwd").val("");
                $("#txtAffirmUserPwd").focus();
                return false;
            }
            return true;
        }

        function ResetInput() {
            $("#txtUserName").val("");
            $("#txtUserPwd").val("");
            $("#txtAffirmUserPwd").val("");
            $("#txtUserAlias").val("");
            $("#Flag_1").click();
            $("#txtUserName").focus();
        }

        function AddNew() {
            $("#editState").val("false");
            ResetInput();
        }
    </script>
</head>
<body>
    <form id="form1" runat="server">

        <uc:Nav ID="Nav1" runat="server"/>

        <!-- main_content begin -->
	    <div id="main_content" class="clearfix">
			
            <!-- search_box begin -->
            <div class="content_box">
                <div class="box_title">
				    <h3 class="subControl">用户搜索</h3>
                </div>
                <div class="box_content">
                    <div id="searchBox">
                        <label for="searchUserName">用户名：</label>
                        <input id="searchUserName" class="textbox" type="text" runat="server"/>
                        <label for="searchUserAlias">用户别名：</label>
                        <input id="searchUserAlias" class="textbox" type="text" runat="server"/>
                        <label for="searchStartRegistTime">注册时间：</label>
                        <input style="margin-right:0;" id="searchStartRegistTime" class="textbox" type="text" runat="server"/>
                        <label>至</label>
                        <input id="searchEndRegistTime" class="textbox" type="text" runat="server"/>
                        <label>账号状态：</label>
                        <asp:DropDownList ID="searchFlag" class="drplist" runat="server"></asp:DropDownList>
                        <asp:Button ID="btnSearch" class="button" runat="server" Text="查询" 
                            onclick="btnSearch_Click" />
                    </div>
                </div>
            <!-- search_box end -->
            </div>
            
		    <!-- content_box begin -->
		    <div class="content_box">
				
			    <div class="box_title">
				    <h3 class="subControl">用户管理</h3>
				    <ul class="box_title_tabs">
					    <li class="current">列表</li>
					    <li>新建/编辑</li>
				    </ul>
			    </div>

			    <div class="box_content">
					
				    <div id="msgPrompt" class="information" style="display:none;">
					    <img class="infoclose" alt="关闭" src="images/icons/cross_grey_small.gif" />
					    <div>提醒信息！</div>
				    </div>

				    <div id="dataList" class="box_content_tab">
					    <table>
						    <thead>
							    <tr>
								    <th><input id="check_all" type="checkbox" /></th>
								    <th>用户名</th>
								    <th>用户别名</th>
								    <th>注册时间</th>
								    <th>最后登录</th>
								    <th>登录次数</th>
                                    <th>账号状态</th>
                                    <th>最后登录IP</th>
                                    <th>用户操作</th>
							    </tr>
						    </thead>

						    <tbody>
                                <asp:Repeater ID="rptDataList" runat="server">
                                    <ItemTemplate>
                                        <tr>
								            <td><input value='<%# Eval("ID") %>' type="checkbox" /></td>
								            <td><%# Eval("UserName")%></td>
								            <td><%# Eval("UserAlias")%></td>
								            <td><%# Eval("RegistTime")%></td>
                                            <td><%# Eval("LastLoginTime")%></td>
                                            <td><%# Eval("LoginCount")%></td>
                                            <td><%# new fanfu.Business.AdminUserRule().GetFlagDes(Eval("Flag"))%></td>
                                            <td><%# Eval("LastLoginIP")%></td>
								            <td>
									            <input title="Edit" class="btnEdit" type="button" onfocus="this.blur()" />
									            <input title="Delete" class="btnDelete" type="button" onfocus="this.blur()" />
								            </td>
							            </tr>
                                    </ItemTemplate>
                                </asp:Repeater>
						    </tbody>

						    <tfoot>
							    <tr>
								    <td colspan="9">
									    <div id="bulk_actions">
                                            <asp:Button ID="btnDelete" class="button" runat="server" Text="批量删除" 
                                                onclick="btnDelete_Click" />
									    </div>
									    <div id="paging" runat="server"></div>
								    </td>
							    </tr>
						    </tfoot>
					    </table>
				    </div>
					
				    <div id="addEdit" class="box_content_tab" style="display:none;">
					    <table>
						    <tbody>
							    <tr>
								    <td width="70"><label for="txtUserName">用户名：</label></td>
								    <td>
                                        <input id="txtUserName" class="textbox" type="text" runat="server"/>
                                    </td>
							    </tr>
							    <tr>
								    <td><label for="txtUserPwd">输入密码：</label></td>
								    <td>
									    <input id="txtUserPwd" class="textbox" type="password" runat="server" />
								    </td>
							    </tr>
                                <tr>
								    <td><label for="txtAffirmUserPwd">再次输入：</label></td>
								    <td>
									    <input id="txtAffirmUserPwd" class="textbox" type="password" runat="server" />
								    </td>
							    </tr>
                                <tr>
								    <td><label for="txtUserAlias">用户别名：</label></td>
								    <td>
									    <input id="txtUserAlias" class="textbox" type="text" runat="server" />
								    </td>
							    </tr>
							    <tr>
								    <td>用户状态：</td>
								    <td>
                                        <input id="Flag_1" name="Flag" class="radio" type="radio" value="1" checked="true" runat="server" /><label for="Flag_1">正常</label>&nbsp;
                                        <input id="Flag_2" name="Flag" class="radio" type="radio" value="2" runat="server" /><label for="Flag_2">锁定</label>&nbsp;
                                        <input id="Flag_3" name="Flag" class="radio" type="radio" value="3" runat="server" /><label for="Flag_3">删除</label>&nbsp;
                                    </td>
							    </tr>
						    </tbody>
						    <tfoot>
							    <tr>
								    <td>&nbsp;</td>
								    <td>
                                        <input class="button" type="button" onclick="AddNew();" value="新建"/>
                                        <input class="button" type="button" onclick="ResetInput();" value="清空" />
                                        <asp:Button class="button" ID="btnSave" runat="server" OnClientClick="return ValidatorInput();" onclick="btnSave_Click" Text="保存" />
								    </td>
							    </tr>
						    </tfoot>
					    </table>
				    </div> 
			    </div>

            <input id="deleteID" type="hidden" runat="server" />
            <input id="editID" type="hidden" runat="server" />
            <input id="editState" type="hidden" runat="server" />
            <asp:LinkButton ID="lbtnEdit" runat="server" onclick="lbtnEdit_Click"></asp:LinkButton>
		    <!-- content_box end -->
		    </div>

		    <uc:Footer ID="Footer1" runat="server"/>

	    <!-- main_content begin -->
	    </div>
    </form>
</body>
</html>
